<?php
class Pageley_ContentManager_AttributeConfigurationManager {
    private $attributeConfigurations;
    private $defaultAttributeConfiguration;
    
    public function __construct() {
        $this->defaultAttributeConfiguration = new Pageley_ContentManager_DefaultAttributeConfiguration();
    }
    
    public function setAttributeConfigurations($attributeConfigurations) {
        $this->attributeConfigurations = $attributeConfigurations;
    }
    
    public function getAttributeConfiguration($attribute) {
        $result = $this->defaultAttributeConfiguration;
        foreach($this->attributeConfigurations as $attributeConfiguration) {
            if($attributeConfiguration->matches($attribute)) {
                $result = $attributeConfiguration;
                break;
            }
        }
        return $result;
    }
}